package com.usian.controller;


import com.usian.Result;
import com.usian.feign.ItemFeign;
import com.usian.pojo.TbItemCat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/backend/itemCategory")
public class ItemCategoryController {

    @Autowired
    private ItemFeign itemFeign;


    @RequestMapping("selectItemCategoryByParentId")
    public Result selectItemCategoryByParentId(@RequestParam(defaultValue = "0") Long id){

        List<TbItemCat> itemCatList = itemFeign.selectItemCategoryByParentId(id);
        if(itemCatList.size()>0){
            return Result.ok(itemCatList);
        }
        return Result.error("查无数据");
    }
}
